# Contributor: Stuart Cardall <developer@it-offshore.co.uk>
# Maintainer: Stuart Cardall <developer@it-offshore.co.uk>
pkgname=libqmi
pkgver=1.34.0
pkgrel=0
pkgdesc="QMI modem protocol helper library"
url="https://www.freedesktop.org/wiki/Software/libqmi"
arch="all"
license="GPL-2.0-or-later AND LGPL-2.1-or-later"
makedepends="
	bash-completion-dev
	glib-dev
	gobject-introspection-dev
	help2man
	libgudev-dev
	libmbim-dev
	libqrtr-glib-dev
	linux-headers
	meson
	python3
	"
subpackages="
	$pkgname-dev
	$pkgname-doc
	$pkgname-bash-completion
	qmi-utils
	"
source="https://gitlab.freedesktop.org/mobile-broadband/libqmi/-/archive/$pkgver/libqmi-$pkgver.tar.gz"

build() {
	abuild-meson \
		-Db_lto=true \
		. output
	meson compile -C output
}

check() {
	local tests=$(meson test --list -C output)
	case "$CARCH" in
		s390x) tests=${tests//test-message} ;;
	esac
	meson test --no-rebuild --print-errorlogs -C output $tests
}

package() {
	DESTDIR="$pkgdir" meson install --no-rebuild -C output
}

utils() {
	pkgdesc="$pkgdesc (CLI utilities)"

	amove usr/bin
}

sha512sums="
4be50814c846e986d2f792af1d488e76f9e3d5457741c1e49187232150b4e14fd26538d0850f2c014be0144b61781827787ca466cd94f1032019ec69e3ab3f3b  libqmi-1.34.0.tar.gz
"
